<?php


namespace api\zmt\controller;


use api\zmt\model\NavModel;
use cmf\controller\RestBaseController;

class NavController extends RestBaseController
{
    public function index()
    {
        //获取搜索字段
        $key = input('key');
        $page = input('page/d',1);
        $pageSize = input('page_size/d',10);
        $where = [];
        //判断是否有值
        if($key){
            $where[] = ['title', 'like', '%' . $key . '%'];
        }
        $list = NavModel::order(['id'=>'DESC'])
            ->where($where)
            ->page($page,$pageSize)
            ->select();
        $this->success('导航列表',$list);
    }
}